<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <title>地址管理</title>

    <div th:replace="common_cssjs"></div>
    <link type="text/css" rel="stylesheet" media="screen" th:href="@{/css/index.css}">
    <script th:src="@{/js/userAddress.js}" type="text/javascript"></script>
</head>

<body>
<div th:replace="common/header::nav"></div>
<div class="container">
    <div th:replace="common/adminNav::user"></div>
    <div class="row">
        <div id="errorTip" style="display: none" class="alert alert-warn">发生错误</div>
        <div id="addAddressSuccess" style="display: none" class="alert alert-success">添加成功</div>
        <div id="delAddressSuccess" style="display: none" class="alert alert-success">删除成功</div>
        <table class="table table-responsive table-striped">
            <thead>
            <tr>
                <td>收件人</td>
                <td>邮编</td>
                <td>电话</td>
                <td>地址</td>
                <td>操作</td>
            </tr>
            </thead>
            <tbody>
                <tr th:each="userAddress:${userAddressList}" addressId="${userAddress.id}">
                    <td th:text="${userAddress.consignee}">收件人</td>
                    <td th:text="${userAddress.zipcode}">邮编</td>
                    <td th:text="${userAddress.phone}">手机</td>
                    <td th:text="${userAddress.address}">地址</td>
                    <td>
                        <a class="btn btn-info btn-xs delAddresslBtn" th:addressId="${userAddress.id}">删除</a>
                        <a class="btn btn-info btn-xs editAddresslBtn" th:addressId="${userAddress.id}">修改</a>
                    </td>
                </tr>
            </tbody>
        </table>
        <div class="col-md-6 col-md-offset-3">
            <form id="inputForm" role="form" action="/user/userAddress/add"
                       method="post" class="form-horizontal">
                <div class="form-group">
                    <label class="col-sm-2 control-label">收货人</label>
                    <div class="col-sm-10">
                        <input minlength="6" required class="form-control" type="text" id="consignee" name="consignee"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">电话</label>

                    <div class="col-sm-10">
                        <input type="number" required class="form-control" id="phone" name="phone"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">邮编</label>

                    <div class="col-sm-10">
                        <input class="form-control" type="text" id="zipcode" name="zipcode"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">地址</label>

                    <div class="col-sm-10">
                        <textarea class="form-control" name="address" id="address"></textarea>
                    </div>
                </div>
                <div class="text-center">
                    <button type="button" id="addAddressBtn" class="btn btn-primary">保存</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- /container -->
<div th:replace="common/footer::copy"></div>
<script>
    $(function(){
        $('#confirm_trigger').scojs_confirm();
    })
</script>
</body>
</html>